If condition is false → skip the work
test eax, eax
jz .skip
; do work
.skip:
-
1 conditional jump
-
This is the preferred way.
-
Modern CPUs like fall-through execution:
jz skip ; rare case → jump away
; common case → continue naturally
-
This improves:
-
branch prediction
-
pipeline efficiency
-
If condition is true → jump to work
test eax, eax
jnz .do_work
jmp .end
.do_work:
; do work
.end:
-
1 conditional + 1 unconditional jump